How to read data from a large number of files in a folder? [closed]

Posted by Gary Dhillon on Programmers See other posts from Programmers or by Gary Dhillon
Published on 2012-07-09T02:57:57Z Indexed on 2012/07/09 3:22 UTC
Read the original article Hit count: 229

Filed under:

I seem to be having some trouble figuring out a solution for a problem. See the thing is, my code is supposed to read a lot of data from a bunch of files.

I've been thinking of two different approaches: 1) the first one seems simpler, I ask the user if they would like to examine the next file or just quit out of the program.( I believe this is simpler and would take less time to run through.) 2)It reads through all the files and outputs the results for each of them, and then a shared result for all of them.( I think this would be better for what I've been asked to do and it saves the user some hassle.)

If anyone can tell me how to code either of these in C++, I would be very grateful. Here is a sample of the file: 0 -- 19 weight 0 -- 20 weight I use this to determine density and possibly ignore the weights which is a number.

© Programmers or respective owner

Related posts about c++